package com.qs.javame.thread.threadlocal;

public class TestDemo3 {

    public static void main(String[] args) {
        Thread[] threads = new Thread[2];
        MyTask task = new MyTask();
        for (int i = 0; i < 2; i++) {
            threads[i] = new Thread(task);
            threads[i].start();
        }
    }
}

class MyTask implements Runnable {

    private int sum = 0;

    @Override
    public  void run() {
        for (int i = 0; i < 100; i++) {
            try {
                Thread.sleep(5);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

            sum++;
        }

        System.out.println(Thread.currentThread().getName() + "-->>sum=" + sum);
    }
}
